<template>
  <div class="base-container" id="main">
    <t-steps :current="activeForm" status="process" :onChange="onCurChanged">
      <t-step-item v-for="(item,index) in stepList" :title="item.title" :key="index" :content="isSubmit(item.id)">
      </t-step-item>
    </t-steps>
    <t-loading text="加载中..." :fullscreen="false" attach="#main" :loading="applyLoading" size="medium">
    </t-loading>
    <t-form :key="activeForm" :colon="true" v-if="activeForm === 0" labelAlign="top" ref="form" :data="formData0"
            :rules="rules0" class="step-form">
      <t-alert v-if="site_tag === 'jtt'" style="margin-bottom: 14px" theme="info" title="填写说明：">
        <div slot="message">
          <p class="span-title">
            一、主要内容及时间要求
          </p>
          <p class="span-txt">
            本科技示范工程实施情况报告于每年12月10日前由项目承担单位填写，并上报主管单位和厅科技主管部门（各一份）。内容包括：
          </p>
          <p class="span-txt">
            1、项目总体进展情况概述（包括项目总体进度、经费使用情况、本年度参加研究的全时人数等）。
          </p>
          <p class="span-txt">
            2、本报告期所开展的工作及计划执行情况。
          </p>
          <p class="span-txt">
            3、已取得的成果情况。
          </p>
          <p class="span-txt">
            4、组织管理经验、存在问题及建议。
          </p>
          <p class="span-title">
            二、填写格式及要求
          </p>
          <p class="span-txt">
            1、项目执行情况报告要求文字简练，一般不超过3000字。
          </p>
          <p class="span-txt">
            2、涉及需保密的内容请在报告中注明密级。
          </p>
          <!--        <p class="span-txt">-->
          <!--          3、执行情况表中带“（ ）”的条目，请根据条目后所列选项，在“（ ）”内填写相应的数字。-->
          <!--        </p>-->
        </div>
      </t-alert>
      <t-alert v-else style="margin-bottom: 24px" theme="info" title="填写说明：">
        <div slot="message">
          <p class="span-title">
            一、主要内容及时间要求
          </p>
          <p class="span-txt">
            本科技示范工程实施情况报告于每年12月10日前由项目承担单位填写，并上报主管单位和厅科技主管部门（各一份）。内容包括：
          </p>
          <p class="span-txt">
            1、项目总体进展情况概述（包括项目总体进度、经费使用情况、本年度参加研究的全时人数等）
          </p>
          <p class="span-txt">
            2、本报告期所开展的工作及计划执行情况。
          </p>
          <p class="span-txt">
            3、已取得的成果情况。
          </p>
          <p class="span-txt">
            4、组织管理经验、存在问题及建议。
          </p>
          <p class="span-title">
            二、填写格式及要求
          </p>
          <p class="span-txt">
            1、项目执行情况报告要求文字简练，一般不超过3000字。
          </p>
          <p class="span-txt">
            2、涉及需保密的内容请在报告中注明密级。
          </p>
          <!--        <p class="span-txt">-->
          <!--          3、执行情况表中带“（ ）”的条目，请根据条目后所列选项，在“（ ）”内填写相应的数字。-->
          <!--        </p>-->
        </div>
      </t-alert>
      <div style="flex: 1;margin-bottom: 24px">
        <t-form-item name="projectId" label="项目名称">
          <template #label>
            项目名称<span style="color: red">(实施方案之后，验收申请提交之前)</span>
          </template>
          <t-select style="width: 390px" @change="onProjectChange" clearable v-model="formData0.projectId"
                    :options="projectOptions"></t-select>
          <t-button
            @click="dialog.objId=formData0.projectId;dialog.open_plan_detail=true"
            v-if="formData0.projectId" variant="text" class="t-button-link">
            <t-icon name="info-circle" slot="icon"/>
            详情
          </t-button>
        </t-form-item>
        <t-form-item label="项目总体进展情况概述（包括项目总体进度、经费使用情况、本年度参加研究的全时人数等）" name="overview">
          <tiny-mce-editor v-model="formData0.overview" :key="activeForm"></tiny-mce-editor>
        </t-form-item>
      </div>
      <t-row style="text-align: center">
        <t-col :span="12">
          <t-space :size="10">
            <t-button theme="primary" @click="onSubmit0">下一步</t-button>
          </t-space>
        </t-col>
      </t-row>
    </t-form>
    <t-form :key="activeForm" :colon="true" v-if="activeForm === 1" labelAlign="top" ref="form" :data="formData1"
            :rules="rules1"
            class="step-form">
      <div style="flex: 1;margin-bottom: 24px">
        <t-form-item label="本报告期所开展的工作" name="content">
          <tiny-mce-editor v-model="formData1.content" :key="activeForm"></tiny-mce-editor>
        </t-form-item>
        <t-form-item label="计划执行情况" :show-error-message="false" name="researchPlans">
          <project-research-plan ref="project-research-plan" :projectId="projectId" :report-id="getReportId()"
                                 :edit-open="true" v-model="formData1.researchPlans"></project-research-plan>
        </t-form-item>
      </div>
      <t-row style="text-align: center">
        <t-col :span="12">
          <t-space :size="10">
            <t-button  @click="onCurChanged(0)" theme="primary" variant="base">上一步
            </t-button>
            <t-button theme="primary" @click="onSubmit1" >下一步</t-button>
          </t-space>
        </t-col>
      </t-row>
    </t-form>
    <t-form :key="activeForm" :colon="true" v-if="activeForm === 2" labelAlign="top" ref="form" :data="formData2"
            :rules="rules2"
            class="step-form">
      <div style="flex: 1;margin-bottom: 24px">
        <t-form-item label="已取得的成果情况（包括中期成果，已取得专利、发表论文、建立中试线、人才培养等情况的简要描述）" name="content">
          <tiny-mce-editor v-model="formData2.content" :key="activeForm"></tiny-mce-editor>
        </t-form-item>
        <t-form-item label="已取得的成果情况" name="projectExpectResults">
          <project-approach-expect-results ref="project-approach-expect-results" :report-id="getReportId()"
                                           v-model="formData2.projectExpectResults"
                                           :edit-open="true"></project-approach-expect-results>
        </t-form-item>
      </div>
      <t-row style="text-align: center">
        <t-col :span="12">
          <t-space :size="10">
            <t-button  @click="onCurChanged(1)" theme="primary" variant="base">上一步
            </t-button>
            <t-button theme="primary" @click="onSubmit2" >下一步</t-button>
          </t-space>
        </t-col>
      </t-row>
    </t-form>
    <t-form :key="activeForm" :colon="true" v-if="activeForm === 3" labelAlign="top" ref="form" :data="formData3"
            :rules="rules3"
            class="step-form">
      <div style="flex: 1;margin-bottom: 24px">
        <t-form-item label="组织管理经验、存在问题及建议" name="content">
          <tiny-mce-editor v-model="formData3.content" :key="activeForm"></tiny-mce-editor>
        </t-form-item>
      </div>
      <t-row style="text-align: center">
        <t-col :span="12">
          <t-space :size="10">
            <t-button  @click="onCurChanged(2)" theme="primary" variant="base">上一步
            </t-button>
            <t-button theme="primary" :loading="applyLoading" @click="onSubmit3(1)">{{
                applyLoading ? '提交中...' : '暂存'
              }}
            </t-button>
            <t-button theme="primary" :loading="applyLoading" @click="onSubmit3(2)">{{
                applyLoading ? '提交中...' : '提交'
              }}
            </t-button>
          </t-space>
        </t-col>
      </t-row>
    </t-form>
    <implement-plan-detail-dialog :header="dialog.header" :project-id="dialog.objId" :visible.sync="dialog.open_plan_detail"
                            v-if="dialog.open_plan_detail"></implement-plan-detail-dialog>
  </div>
</template>

<script>
import TinyMceEditor from "@/components/TinyMceEditor/index.vue";
import projectApproachExpectResults from "./components/project-approach-expectResults.vue";
import projectResearchPlan from "./components/project-research-plan.vue";
import implementPlanDetailDialog from "./components/implement-plan-detail-dialog.vue";


export default {
  name: "performance-report-apply",
  dicts: ['progress', 'adjust_content', 'main_reason', 'degree', 'prof_tit'],
  components: {
    TinyMceEditor,
    implementPlanDetailDialog,
    projectApproachExpectResults,
    projectResearchPlan
  },
  data() {
    return {
      site_tag: import.meta.env.VITE_SITE_TAG,
      taskId: null,
      projectId: null,
      reportId: null,
      dialog: {
        header: '',
        objId: null,
        open_plan_detail: false,
      },
      activeForm: 0,
      stepList: [
        {
          id: 'step0',
          title: '项目总体进展情况概述',
          require: true,
        },
        {
          id: 'step1',
          title: '本报告期所开展的工作及计划执行情况',
          require: true,
        },
        {
          id: 'step2',
          title: '已取得的成果情况',
          require: true,
        },
        {
          id: 'step3',
          title: '组织管理经验、存在问题及建议',
          require: false,
        },
      ],
      maxlength: 3000,
      applyLoading: false,
      projectOptions: [],
      formData0: {
        projectId: null,
        overview: '',
      },
      rules0: {
        projectId: [
          {
            required: true,
            message: "项目名称不能为空",
          },
        ],
        overview: [
          {
            required: true,
            message: "项目总体进展情况概述不能为空",
          },
        ],
      },
      formData1: {
        content: '',
        reportId: null,
        projectId: null,
        researchPlans: []
      },
      rules1: {
        content: [
          {
            required: true,
            message: "本报告期所开展的工作不能为空",
          },
        ],
        researchPlans: [{required: true, validator: (val) => val && val.length, message: "计划执行情况不能为空", type: "error"}],
      },
      formData2: {
        content: '',
        projectExpectResults: []
      },
      rules2: {
        content: [
          {
            required: true,
            message: "简要描述工作不能为空",
          },
        ],
        projectExpectResults: [{
          required: true,
          validator: (val) => val && val.length,
          message: "已取得的成果情况不能为空",
          type: "error"
        }],
      },
      formData3: {
        content: '',
      },
      rules3: {
        // content: [
        //   {
        //     required: true,
        //     message: "组织管理经验、存在问题及建议不能为空",
        //   },
        // ],
      },
      formData4: {
        dateRange: [],
        reportDate: '',
        startDate: '',
        endDate: '',
        progress: '',
        mainReason: [],
        adjustContent: [],
        workload: '',
        mainWork: '',
        projectId: null,
        projectAnnualReportPatent: {
          foreignCount: 0,
          homeCount: 0,
          otherCount: 0,
        },
        projectAnnualReportResults: {
          newProductCount: 0,
          paperCount: 0,
          monographCount: 0,
          researchReportCount: 0,
          otherCount: 0,
        },
        projectAnnualReportFunding: {
          totalMoney: 0,
          alreadyMoney: 0,
          notMoney: 0,
          dependMoney: 0,
          implementMoney: 0,
        },
        degreeList: [{
          degree: '',
          degreeCount: 0,
          sort: 1
        }],
        profTitList: [{
          profTit: '',
          profTitCount: 0,
          sort: 1
        }],
      },
      lengthLimitObj: {
        mainWork: 0
      },
      rules4: {
        // projectId: [
        //   {
        //     required: true,
        //     message: "项目名称不能为空",
        //   },
        // ],
        reportDate: [
          {
            required: true,
            message: "报告日期不能为空",
          },
        ],
        dateRange: [{required: true, validator: (val) => val && val.length, message: "本报告期的起止时间不能为空", type: "error"}],
        progress: [
          {
            required: true,
            message: "进展情况不能为空",
          },
        ],
        mainReason: [{required: true, validator: (val) => val && val.length, message: "主要原因不能为空", type: "error"}],
        adjustContent: [{required: true, validator: (val) => val && val.length, message: "项目调整内容不能为空", type: "error"}],
        workload: [
          {
            required: true,
            message: "投入研究的工作量(人月)不能为空",
          },
        ],
        mainWork: [
          {
            required: true,
            message: "本报告期的主要研究工作不能为空",
          },
        ]
      }
    }
  },
  watch: {
    activeForm: {
      immediate: true,
      handler(val) {
        const targetEle = document.getElementById("main")
        if (targetEle) {
          const {pos, top} = targetEle.style;
          targetEle.style.position = 'relative';
          targetEle.style.top = '-100px';
          targetEle.scrollIntoView({behavior: 'smooth', block: 'start', inline: "nearest"});
          targetEle.style.top = top;
          targetEle.style.position = pos;
        }
      }
    }
  },
  created() {
    const taskId = this.$route.params && this.$route.params.taskId;
    if (!taskId) {
      this.$message.error("缺少任务Id");
      this.$router.push("/kjsf/implement/performance-report-my");
      return false;
    }
    this.taskId = taskId;
    this.projectId = Number(sessionStorage.getItem(`${taskId}-performance-report-projectId`));
    const activeForm = Number(sessionStorage.getItem(`${taskId}-performance-report-activeForm`)) || 0;
    this.onCurChanged(activeForm)
    this.getProjectList();
  },
  methods: {
    getReportId() {
      return sessionStorage.getItem(`${this.taskId}-performance-report-step0`);
    },
    isSubmit(name) {
      return sessionStorage.getItem(`${this.taskId}-performance-report-${name}`) ? '已提交' : '未提交';
    },
    onCurChanged(cur, pre) {
      if (Number(cur) !== 0) {
        if (!sessionStorage.getItem(`${this.taskId}-performance-report-step0`)) {
          this.applyLoading = false;
          this.$message.error("项目总体进展情况概述还未提交")
          return false;
        }
      }
      if (!this.applyLoading) {
        this.applyLoading = true;
      }
      // 根据不同的activeForm 复查数据
      if (Number(cur) === 0) {
        if (sessionStorage.getItem(`${this.taskId}-performance-report-step0`)) {
          const objId = Number(sessionStorage.getItem(`${this.taskId}-performance-report-step0`));
          this.$api.kjsf.implement.performanceReportGet(objId).then(response => {
            if (response.data) {
              Object.assign(this.formData0, response.data)
            }
            this.activeForm = cur;
            sessionStorage.setItem(`${this.taskId}-performance-report-activeForm`, cur);
            this.applyLoading = false;
          }).catch((e) => {
            this.applyLoading = false;
            this.$message.error(e.toString());
          });
        } else {
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-performance-report-activeForm`, cur);
          this.applyLoading = false;
        }
      } else if (Number(cur) === 1) {
        if (sessionStorage.getItem(`${this.taskId}-performance-report-step0`)) {
          const objId = Number(sessionStorage.getItem(`${this.taskId}-performance-report-step0`));
          this.$api.kjsf.implement.performanceReportPlanGetByReportId(objId).then(response => {
            if (response.data) {
              Object.assign(this.formData1, response.data)
            }
            this.activeForm = cur;
            sessionStorage.setItem(`${this.taskId}-performance-report-activeForm`, cur);
            this.applyLoading = false;
          }).catch((e) => {
            this.applyLoading = false;
            this.$message.error(e.toString());
          });
        } else {
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}--performance-report-activeForm`, cur);
          this.applyLoading = false;
        }

      } else if (Number(cur) === 2) {
        if (sessionStorage.getItem(`${this.taskId}-performance-report-step0`)) {
          const objId = Number(sessionStorage.getItem(`${this.taskId}-performance-report-step0`));
          this.$api.kjsf.implement.performanceReportResultsGetByReportId(objId).then(response => {
            if (response.data) {
              Object.assign(this.formData2, response.data)
            }
            this.activeForm = cur;
            sessionStorage.setItem(`${this.taskId}-performance-report-activeForm`, cur);
            this.applyLoading = false;
          }).catch((e) => {
            this.applyLoading = false;
            this.$message.error(e.toString());
          });
        } else {
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-performance-report-activeForm`, cur);
          this.applyLoading = false;
        }

      } else if (Number(cur) === 3) {
        if (sessionStorage.getItem(`${this.taskId}-performance-report-step0`)) {
          const objId = Number(sessionStorage.getItem(`${this.taskId}-performance-report-step0`));
          this.$api.kjsf.implement.performanceReportExperienceGetByReportId(objId).then(response => {
            if (response.data) {
              Object.assign(this.formData3, response.data)
            }
            this.activeForm = cur;
            sessionStorage.setItem(`${this.taskId}-performance-report-activeForm`, cur);
            this.applyLoading = false;
          }).catch((e) => {
            this.applyLoading = false;
            this.$message.error(e.toString());
          });
        } else {
          this.activeForm = cur;
          sessionStorage.setItem(`${this.taskId}-performance-report-activeForm`, cur);
          this.applyLoading = false;
        }

      }else {
        this.activeForm = cur;
        sessionStorage.setItem(`${this.taskId}-performance-report-activeForm`, cur);
        this.applyLoading = false;
      }
    },
    addDegree() {
      this.formData4.degreeList.push({
        degree: '',
        degreeCount: 0,
        sort: 1
      });
    },
    delDegree(index) {
      this.formData4.degreeList.splice(index, 1);
    },
    addProfTit() {
      this.formData4.profTitList.push({
        profTit: '',
        profTitCount: 0,
        sort: 1
      });
    },
    delProfTit(index) {
      this.formData4.profTitList.splice(index, 1);
    },
    getProjectList() {
      this.$api.kjsf.implement.changeApplyMyProjectList().then(response => {
        this.projectOptions = response.data.map(val => {
          return {
            label: val.projectName,
            value: val.id,
            ...val,
          }
        });
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    onProjectChange(val, content) {
      this.projectId = val;
      this.dialog.header = content.option.projectName;
      sessionStorage.setItem(`${this.taskId}-performance-report-projectId`, val);
    },
    onSubmit0() {
      this.$refs.form.validate().then((validateResult) => {
        if (validateResult === true) {
          this.applyLoading = true;
          // 判断是否提交过
          if (sessionStorage.getItem(`${this.taskId}-performance-report-step0`)) {
            this.$api.kjsf.implement.performanceReportUpdate(this.formData0).then(response => {
              this.$message.success("提交成功")
              this.onCurChanged(1);
            }).catch(e => {
              this.applyLoading = false;
              this.$message.error(e.toString())
            })
          } else {
            this.$api.kjsf.implement.performanceReportAdd(this.formData0).then(response => {
              this.$message.success("提交成功")
              sessionStorage.setItem(`${this.taskId}-performance-report-step0`, response.data.id);
              this.onCurChanged(1);
            }).catch(e => {
              this.applyLoading = false;
              this.$message.error(e.toString())
            })
          }

        } else {
          const firstError = Object.values(validateResult)[0]?.[0]?.message;
          this.$message.error(firstError);
        }
      })
    },
    onSubmit1() {
      this.$refs.form.validate().then((validateResult) => {
        if (validateResult === true) {
          const isValidate = this.$refs["project-research-plan"].checkData()
          if (!isValidate) {
            return false;
          }
          this.applyLoading = true;
          // 判断是否提交过
          if (sessionStorage.getItem(`${this.taskId}-performance-report-step1`)) {
            this.$api.kjsf.implement.performanceReportPlanUpdate({
              ...this.formData1,
              projectId: this.projectId,
              reportId: sessionStorage.getItem(`${this.taskId}-performance-report-step0`),
            }).then(response => {
              this.$message.success("提交成功")
              this.onCurChanged(2);
            }).catch(e => {
              this.applyLoading = false;
              this.$message.error(e.toString())
            })
          } else {
            this.$api.kjsf.implement.performanceReportPlanAdd({
              ...this.formData1,
              projectId: this.projectId,
              reportId: sessionStorage.getItem(`${this.taskId}-performance-report-step0`),
            }).then(response => {
              this.$message.success("提交成功")
              sessionStorage.setItem(`${this.taskId}-performance-report-step1`, response.data.id);
              this.onCurChanged(2);
            }).catch(e => {
              this.applyLoading = false;
              this.$message.error(e.toString())
            })
          }
        } else {
          const firstError = Object.values(validateResult)[0]?.[0]?.message;
          this.$message.error(firstError);
        }
      })
    },
    onSubmit2() {
      this.$refs.form.validate().then((validateResult) => {
        if (validateResult === true) {
          const isValidate = this.$refs["project-approach-expect-results"].checkData()
          if (!isValidate) {
            return false;
          }
          this.applyLoading = true;
          // 判断是否提交过
          if (sessionStorage.getItem(`${this.taskId}-performance-report-step2`)) {
            this.$api.kjsf.implement.performanceReportResultsUpdate({
              ...this.formData2,
              projectId: this.projectId,
              reportId: sessionStorage.getItem(`${this.taskId}-performance-report-step0`),
            }).then(response => {
              this.$message.success("提交成功")
              this.onCurChanged(3);
            }).catch(e => {
              this.applyLoading = false;
              this.$message.error(e.toString())
            })
          } else {
            this.$api.kjsf.implement.performanceReportResultsAdd({
              ...this.formData2,
              projectId: this.projectId,
              reportId: sessionStorage.getItem(`${this.taskId}-performance-report-step0`),
            }).then(response => {
              this.$message.success("提交成功")
              sessionStorage.setItem(`${this.taskId}-performance-report-step2`, response.data.id);
              this.onCurChanged(3);
            }).catch(e => {
              this.applyLoading = false;
              this.$message.error(e.toString())
            })
          }
        } else {
          const firstError = Object.values(validateResult)[0]?.[0]?.message;
          this.$message.error(firstError);
        }
      })
    },
    onSubmit3(type) {
      if (type === 1) {
        this.applyLoading = true;
        if (sessionStorage.getItem(`${this.taskId}-performance-report-step3`)) {
          this.$api.kjsf.implement.performanceReportExperienceUpdate({
            ...this.formData3,
            projectId: this.projectId,
            reportId: sessionStorage.getItem(`${this.taskId}-performance-report-step0`),
          }).then(response => {
            this.applyLoading = false;
            this.$message.success("暂存成功")
          }).catch(e => {
            this.applyLoading = false;
            this.$message.error(e.toString())
          })
        } else {
          this.$api.kjsf.implement.performanceReportExperienceAdd({
            ...this.formData3,
            projectId: this.projectId,
            reportId: sessionStorage.getItem(`${this.taskId}-performance-report-step0`),
          }).then(response => {
            this.applyLoading = false;
            this.$message.success("暂存成功")
            sessionStorage.setItem(`${this.taskId}-performance-report-step3`, response.data.id);
          }).catch(e => {
            this.applyLoading = false;
            this.$message.error(e.toString())
          })
        }
      }else {
        this.$refs.form.validate().then((validateResult) => {
          if (validateResult === true) {
            this.stepList.forEach((val)=>{
              if (!sessionStorage.getItem(`${this.taskId}-performance-report-${val.id}`) && val.require) {
                this.$message.error(`${val.title}还未提交`)
                this.applyLoading = false;
                return false;
              }
            })

            const confirmDia = this.$dialog.confirm({
              header: "提交后不可再编辑会进入审批流程",
              body: `是否确认提交？`,
              theme: "warning",
              onConfirm: ({e}) => {
                confirmDia.update({
                  confirmBtn: {
                    loading: true,
                  },
                })
                this.applyLoading = true;
                // 判断是否提交过
                if (sessionStorage.getItem(`${this.taskId}-performance-report-step3`)) {
                  this.$api.kjsf.implement.performanceReportExperienceUpdate({
                    ...this.formData3,
                    projectId: this.projectId,
                    reportId: sessionStorage.getItem(`${this.taskId}-performance-report-step0`),
                  }).then(response => {
                    this.$api.kjsf.implement.performanceReportSubmit({
                      projectId: this.projectId,
                      id: sessionStorage.getItem(`${this.taskId}-performance-report-step0`),
                    }).then(response => {
                      this.applyLoading = false;
                      confirmDia.destroy();
                      this.$message.success('提交成功');
                      this.close();
                    }).catch((e) => {
                      this.applyLoading = false;
                      confirmDia.update({
                        confirmBtn: {
                          loading: false,
                        },
                      })
                      this.$message.error(e.toString());
                    });
                  }).catch(e => {
                    this.applyLoading = false;
                    confirmDia.update({
                      confirmBtn: {
                        loading: false,
                      },
                    })
                    this.$message.error(e.toString())
                  })
                } else {
                  this.$api.kjsf.implement.performanceReportExperienceAdd({
                    ...this.formData3,
                    projectId: this.projectId,
                    reportId: sessionStorage.getItem(`${this.taskId}-performance-report-step0`),
                  }).then(response => {
                    sessionStorage.setItem(`${this.taskId}-performance-report-step3`, response.data.id)
                    this.$api.kjsf.implement.performanceReportSubmit({
                      projectId: this.projectId,
                      id: sessionStorage.getItem(`${this.taskId}-performance-report-step0`),
                    }).then(response => {
                      this.applyLoading = false;
                      this.$message.success('提交成功');
                      confirmDia.destroy();
                      this.close();
                    }).catch((e) => {
                      this.applyLoading = false;
                      confirmDia.update({
                        confirmBtn: {
                          loading: false,
                        },
                      })
                      this.$message.error(e.toString());
                    });
                  }).catch(e => {
                    this.applyLoading = false;
                    confirmDia.update({
                      confirmBtn: {
                        loading: false,
                      },
                    })
                    this.$message.error(e.toString())
                  })
                }
              },
            })



          } else {
            const firstError = Object.values(validateResult)[0]?.[0]?.message;
            this.$message.error(firstError);
          }
        })
      }
    },
    close() {
      this.$tab.closeOpenPage({path: "/kjsf/implement/performance-report-my"});
    }
  }
}
</script>

<style lang="less" scoped>
.base-container {
  display: flex;
  flex-direction: column;
}

.step-form {
  padding: 0 24px;
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

//.t-row {
//  margin-bottom: 14px;
//}

.span-title {
  font-weight: bold;
}

.span-sub-txt {
  margin-left: 20px;
}

.table-form {
  /deep/ .t-radio.t-is-disabled .t-radio__label {
    color: unset
  }

  /deep/ .t-is-error .t-input__extra {
    position: static;
  }

  /deep/ .t-form__label {
    display: none;
  }

  .t-form__item {
    width: 100%;
  }

  .t-row {
    align-items: stretch;
    margin-bottom: 0px;

    .require {
      color: red;
      margin-right: 3px;
    }

    .t-col {
      border: 1px solid #ddd;
      color: #333;
      min-height: 37px;
      padding: 4px !important;
      //overflow: hidden;
      display: flex;
      align-items: center;
      margin: 0px -1px -1px 0px;

      .t-row {
        width: 100%;
      }
    }

    .title {
      background-color: #FAFAFA;
      justify-content: center;
      margin: 0px -1px -1px 0px;
      color: #000000;
      font-size: 16px;
      font-family: '宋体', serif;
      font-weight: bold;
    }
  }
}
</style>
